package com.lhjmall.coupon.service.impl;

import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lhjmall.common.utils.PageUtils;
import com.lhjmall.common.utils.Query;

import com.lhjmall.coupon.dao.UsercouponDao;
import com.lhjmall.coupon.entity.UsercouponEntity;
import com.lhjmall.coupon.service.UsercouponService;


@Service("usercouponService")
public class UsercouponServiceImpl extends ServiceImpl<UsercouponDao, UsercouponEntity> implements UsercouponService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<UsercouponEntity> page = this.page(
                new Query<UsercouponEntity>().getPage(params),
                new QueryWrapper<UsercouponEntity>()
        );

        return new PageUtils(page);
    }

	@Override
	public void sendCoupon(Integer userId) {
		UsercouponEntity usercouponEntity=new UsercouponEntity();
		usercouponEntity.setCouponid(1);
		usercouponEntity.setName("立减30");
		usercouponEntity.setPrice(new BigDecimal(30));
		usercouponEntity.setStatus(1);
		usercouponEntity.setUserid(userId);
		this.save(usercouponEntity);
	}

}